<div class="content-left bag-white">
	<div style="margin-bottom: 10px" class="sub-left">
        <div class="bag-title-blue">
              <img src="<?php echo $this->imgUrl;?>/icon/icon-tour.png" alt=""  />
              <p>Giỏ hàng</p>
        </div>
    </div>
	<div class="detail">
		<div class="order-cart">
                    		<table cellpadding="0" cellspacing="0">
                    			<tr class="sub-cart">
                    				<td class="first" width="20">ID</td>
                    				<td>Tên sản phẩm</td>
                    				<td width="50">Số lượng</td>
                    				<td width="60">Giá</td>
                    				<td>Giá khuyến mãi</td>
                    				<td width="80">Tổng tiền</td>
                    			</tr>
                    			<?php
	                            	$cart = $this->cart;
	                            	$linkOrder = $this->baseUrl('/products/index/order');
	                            	$linkUpdate = $this->baseUrl('/products/index/add-item');
	                            	$linkBack = $this->baseUrl('/products/index/index');
	                            	if(count($this->Items)>0){
	                            		$totalPrice = 0;
	                            		foreach ($this->Items as $key => $val){
	                            			$name = $val['name'];
	                            			$id = $val['id'];
	                            			$price 		= number_format($val['price'],null);
                    						$selloff 	= $val['selloff'];
	                            			$quantity = $cart[$id];
	                            			$total = 0;
	                            			if($selloff <=0 ){
			                          			$price = '<span class="price-1" style="">' . $price . '</span> ';
			                          			$selloff = ' ';
			                          			$total = $quantity * $val['price'];
			                          			$totalPrice += $total;
			                          			$total =  $total;
			                          		}else{
			                          			$price = '<span class="price-1" style="text-decoration: line-through;">' . $price . '</span> ';
			                          			$selloff =  $val['selloff']; 
			                          			$total = $quantity * $val['selloff']; 
			                          			$totalPrice += $total;
			                          			$total =  $total;		 
			                          		}
			                          		
			                          		$filter = new Zend_Filter();
											$multiFilter = $filter	->addFilter(new Zend_Filter_StringToLower(array('encoding'=>'UTF-8')))
																 	->addFilter(new Zend_Filter_StringTrim())
										 						 	->addFilter(new Zend_Filter_Alnum(true))
										  						 	->addFilter(new Zend_Filter_PregReplace(array('match'=>'#\s+#','replace'=>'-')))
										  							->addFilter(new Zend_Filter_Word_SeparatorToDash())
										  							->addFilter(new Zendvn_Filter_RemoveCircumflex());
										  
			                          		$linkDetial = $this->baseUrl('/products/index/detail/cid/' . $val['cat_id'] 
		                          									 . '/tcat/' . $filter->filter($val['category_name']) 
		                          									 . '/id/' . $val['id'] . '/title/' . $filter->filter($val['name']));
	
		                          		    $itemProduct = 'itemProduct[' . $val['id'] . ']';				 
	                            			$itemProduct = $this->formText($itemProduct,$quantity,
	                            											array('style'=>'width: 35px; text-align: center; font-size: 11px; background-color:#FFC;padding: 2px 2px;'));

	                            			$linkDelete		= $this->baseUrl($this->currentController . '/delete/id/' . $id);
											$btnDelete 		=  $this->cmsAjaxButton('ajax-delete-item', 'Delete Item', 'Delete *'. $name . '*', $linkDelete, $id);
	                            ?>
                            <div class="err"><?php //echo $errors;?></div>
                    			<tr>
                    				<td class="first"><?php echo $id;?></td>
                    				<td style="text-align: left;"><strong><a href="<?php echo $linkDetial;?>" class="itemLink" target="_blank"><?php echo $name;?></a></strong></td>
                    				<td><?php echo $itemProduct;?></td>
                    				<td><?php echo $price;?></td>
                    				<td><?php echo number_format($selloff);?></td>
                    				<td><?php echo number_format($total);?></td>
                    				<input type="hidden" value="<?php echo $this->arrParam['action']; ?>" name="hidden" />
                    			</tr>
                    			<?php 
                            		}
                            	}
                         	?> 
                    		</table>
                    		<p class="total-money">Tổng số tiền thanh toán : <strong><?php echo number_format($totalPrice,null) . ' (VND)';?></strong></p>
                    		
                    	</div>
                        <?php
                        	$user = $this->User;
                        	$valFullname 	= $this->arrParam['fullname'];
                        	$valemail 		= $this->arrParam['email'];
                        	if(!empty($user)){
                        		$valFullname = $user['first_name'] . ' ' . $user['last_name'];
                        		$valEmail = $user['email'];
                        		$valAddress = $user['address'];
                        		if (empty($valAddress)) $valAddress = $this->arrParam['address'];
                        		$valPhone = $user['phone']; 
                        		if (empty($valPhone)) $valPhone = $this->arrParam['phone'];
                        	}
                     		$full_name = $this->formText('full_name',$valFullname,array('style'=>'width: 60%;','class'=>'text'));
                     		$email = $this->formText('email',$valEmail,array('style'=>'width: 60%;','class'=>'text'));
                     		$phone = $this->formText('phone',$valPhone,array('style'=>'width: 60%;','class'=>'text'));
                     		$address = $this->formTextarea('address',$valAddress,array('rows'=>4,'style'=>'width: 90%;','class'=>'midium-text'));
                     		$shipping = $this->formTextarea('shipping',$this->arrParam['shipping'],array('rows'=>4,'style'=>'width: 90%;','class'=>'midium-text'));
                     		$comment = $this->formTextarea('comment',$this->arrParam['comment'],array('rows'=>4,'style'=>'width: 90%;','class'=>'midium-text'));
                     		$submit			= $this->formSubmit('submit','Gửi thông tin',array("class"=>"submit"));
                     		//------------------------MESSAGES ERROR----------------------
                     		if(count($this->errors)>0){
									$errors = $this->errors;
								}
							?>
						<div class="info-cart">	
	                     	<form name="your-cart" id="your-cart" action="" method="post">
		                        <div class="lev">
					                 <span>Họ và tên: </span><?php echo $full_name;?>
					                 <div><?php if(!empty($errors['full_name'])):echo '<p class="msg_error">'.$errors['full_name'].'</p>';endif;?></div>
					            </div>
					            <div class="lev">
					                 <span>Email: </span><?php echo $email;?>
					                 <div><?php if(!empty($errors['email'])):echo '<p class="msg_error">'.$errors['email'].'</p>';endif;?></div>
					            </div>
					            <div class="lev">
					                 <span>Điện thoại: </span><?php echo $phone?>
					                 <div><?php if(!empty($errors['phone'])):echo '<p class="msg_error">'.$errors['phone'].'</p>';endif;?></div>
					            </div>
					            <div class="lev">
					                 <span>Địa chỉ: </span><?php echo $address;?>
					                 <div><?php if(!empty($errors['address'])):echo '<p class="msg_error">'.$errors['address'].'</p>';endif;?></div>
					            </div>
					            <div class="lev">
					                 <span>Giao hàng tại: </span><?php echo $shipping;?>
					                 <div><?php if(!empty($errors['shipping'])):echo '<p class="msg_error">'.$errors['shipping'].'</p>';endif;?></div>
					            </div>
					            <div class="lev">
					                 <span>Ghi chú: </span><?php echo $comment;?>
					                 <div><?php if(!empty($errors['comment'])):echo '<p class="msg_error">'.$errors['comment'].'</p>';endif;?></div>
					            </div>
					            <div class="lev">
					             	<div><?php echo $submit;?></div>
					            </div>
					                             
	                        </form>
                        </div>
	</div>
</div>